<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>绑定表单 | 我的笔记</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-emphasize/plugin.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-prism/prism-solarizedlight.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
    

        
    
    
    <link rel="next" href="../VUE/3、组件之间的数据传递.html" />
    
    
    <link rel="prev" href="../VUE/1、绑定class和style.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="11.2"
        data-chapter-title="绑定表单"
        data-filepath="VUE/2、绑定表单.md"
        data-basepath=".."
        data-revision="Mon Oct 22 2018 12:05:33 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="gitbook的安装.html">
            
                
                    <a href="../gitbook的安装.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        gitbook的安装
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2" data-path="HTML and CSS/1、css的引入方式.html">
            
                
                    <a href="../HTML and CSS/1、css的引入方式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        HTML and CSS
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="HTML and CSS/3、常用的标签.html">
            
                
                    <a href="../HTML and CSS/3、常用的标签.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        常用的标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="HTML and CSS/4、表格的使用.html">
            
                
                    <a href="../HTML and CSS/4、表格的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        表格的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="HTML and CSS/5、表单.html">
            
                
                    <a href="../HTML and CSS/5、表单.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        表单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="HTML and CSS/6、a标签的使用.html">
            
                
                    <a href="../HTML and CSS/6、a标签的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        a标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="HTML and CSS/7、盒子模型.html">
            
                
                    <a href="../HTML and CSS/7、盒子模型.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        盒子模型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="HTML and CSS/8、浮动.html">
            
                
                    <a href="../HTML and CSS/8、浮动.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        浮动
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="HTML and CSS/9、css常见问题.html">
            
                
                    <a href="../HTML and CSS/9、css常见问题.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        css常见问题
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="HTML and CSS/10、位置定位.html">
            
                
                    <a href="../HTML and CSS/10、位置定位.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.</b>
                        
                        位置定位
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="HTML and CSS/11、阴影设置.html">
            
                
                    <a href="../HTML and CSS/11、阴影设置.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.9.</b>
                        
                        阴影设置
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="HTML and CSS/12、自定义动画.html">
            
                
                    <a href="../HTML and CSS/12、自定义动画.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.</b>
                        
                        动画
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="HTML and CSS/13、容器居中方法.html">
            
                
                    <a href="../HTML and CSS/13、容器居中方法.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.11.</b>
                        
                        容器居中
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="HTML and CSS/14、fullpage的使用.html">
            
                
                    <a href="../HTML and CSS/14、fullpage的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.12.</b>
                        
                        fullpage的使用
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="移动端/移动端.html">
            
                
                    <a href="../移动端/移动端.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        移动端
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="移动端/1、关于移动端.html">
            
                
                    <a href="../移动端/1、关于移动端.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        关于移动端
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="移动端/2、移动端小问题.html">
            
                
                    <a href="../移动端/2、移动端小问题.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        移动端小问题
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="flex布局/flex.html">
            
                
                    <a href="../flex布局/flex.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        flex弹性盒子
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="flex布局/1、flex布局.html">
            
                
                    <a href="../flex布局/1、flex布局.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        flex布局
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="响应式布局/bootstrap.html">
            
                
                    <a href="../响应式布局/bootstrap.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        响应式布局
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="响应式布局/1、Bootstrap.html">
            
                
                    <a href="../响应式布局/1、Bootstrap.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        Bootstrap
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="响应式布局/2、媒体查询.html">
            
                
                    <a href="../响应式布局/2、媒体查询.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        媒体查询
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="JavaScript/JavaScript.html">
            
                
                    <a href="../JavaScript/JavaScript.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        JavaScript
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1" data-path="JavaScript/1、JavaScript数据类型.html">
            
                
                    <a href="../JavaScript/1、JavaScript数据类型.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        JS数据类型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="JavaScript/2、数据类型的转换.html">
            
                
                    <a href="../JavaScript/2、数据类型的转换.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        数据类型的转换
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="JavaScript/3、运算符.html">
            
                
                    <a href="../JavaScript/3、运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                        运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="JavaScript/4、赋值运算符.html">
            
                
                    <a href="../JavaScript/4、赋值运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.</b>
                        
                        赋值运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.5" data-path="JavaScript/5、比较运算符.html">
            
                
                    <a href="../JavaScript/5、比较运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.5.</b>
                        
                        比较运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.6" data-path="JavaScript/6、逻辑操作符.html">
            
                
                    <a href="../JavaScript/6、逻辑操作符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.6.</b>
                        
                        逻辑操作符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.7" data-path="JavaScript/7、条件运算符.html">
            
                
                    <a href="../JavaScript/7、条件运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.7.</b>
                        
                        条件运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.8" data-path="JavaScript/8、位运算符.html">
            
                
                    <a href="../JavaScript/8、位运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.8.</b>
                        
                        位运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.9" data-path="JavaScript/9、条件语句.html">
            
                
                    <a href="../JavaScript/9、条件语句.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.9.</b>
                        
                        条件语句
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.10" data-path="JavaScript/10、循环语句.html">
            
                
                    <a href="../JavaScript/10、循环语句.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.10.</b>
                        
                        循环语句
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.11" data-path="JavaScript/11、break和continue.html">
            
                
                    <a href="../JavaScript/11、break和continue.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.11.</b>
                        
                        break和continue
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.12" data-path="JavaScript/12、for循环.html">
            
                
                    <a href="../JavaScript/12、for循环.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.12.</b>
                        
                        for循环
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.13" data-path="JavaScript/13、多层循环.html">
            
                
                    <a href="../JavaScript/13、多层循环.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.13.</b>
                        
                        多层循环
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.14" data-path="JavaScript/14、for-in循环.html">
            
                
                    <a href="../JavaScript/14、for-in循环.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.14.</b>
                        
                        for-in循环
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.15" data-path="JavaScript/15、try-catch语句.html">
            
                
                    <a href="../JavaScript/15、try-catch语句.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.15.</b>
                        
                        try-catch语句
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.16" data-path="JavaScript/16、函数.html">
            
                
                    <a href="../JavaScript/16、函数.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.16.</b>
                        
                        函数
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.17" data-path="JavaScript/17、循环排序.html">
            
                
                    <a href="../JavaScript/17、循环排序.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.17.</b>
                        
                        循环排序
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.18" data-path="JavaScript/18、es6语法.html">
            
                
                    <a href="../JavaScript/18、es6语法.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.18.</b>
                        
                        es6语法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.19" data-path="JavaScript/19、数组对象.html">
            
                
                    <a href="../JavaScript/19、数组对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.19.</b>
                        
                        数组对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.20" data-path="JavaScript/20、date对象.html">
            
                
                    <a href="../JavaScript/20、date对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.20.</b>
                        
                        date对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.21" data-path="JavaScript/21、Boolean对象.html">
            
                
                    <a href="../JavaScript/21、Boolean对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.21.</b>
                        
                        Boolean对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.22" data-path="JavaScript/22、数学对象.html">
            
                
                    <a href="../JavaScript/22、数学对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.22.</b>
                        
                        数学对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.23" data-path="JavaScript/23、对象的创建.html">
            
                
                    <a href="../JavaScript/23、对象的创建.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.23.</b>
                        
                        对象的创建
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7" data-path="BOM/BOM.html">
            
                
                    <a href="../BOM/BOM.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        BOM
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.1" data-path="BOM/1、window对象.html">
            
                
                    <a href="../BOM/1、window对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.1.</b>
                        
                        window对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.2" data-path="BOM/2、navigator对象.html">
            
                
                    <a href="../BOM/2、navigator对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.2.</b>
                        
                        navigator对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.3" data-path="BOM/3、screen对象.html">
            
                
                    <a href="../BOM/3、screen对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.3.</b>
                        
                        screen对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.4" data-path="BOM/4、history对象.html">
            
                
                    <a href="../BOM/4、history对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.4.</b>
                        
                        history对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.5" data-path="BOM/5、location对象.html">
            
                
                    <a href="../BOM/5、location对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.5.</b>
                        
                        location对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.6" data-path="BOM/6、cookie对象.html">
            
                
                    <a href="../BOM/6、cookie对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.6.</b>
                        
                        cookie对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.7" data-path="BOM/7、html5本地存储.html">
            
                
                    <a href="../BOM/7、html5本地存储.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.7.</b>
                        
                        html5本地存储
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="8" data-path="DOM/DOM.html">
            
                
                    <a href="../DOM/DOM.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        DOM
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.1" data-path="DOM/1、DOM介绍.html">
            
                
                    <a href="../DOM/1、DOM介绍.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.1.</b>
                        
                        DOM介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.2" data-path="DOM/2、元素对象.html">
            
                
                    <a href="../DOM/2、元素对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.2.</b>
                        
                        元素对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.3" data-path="DOM/3、DOM事件1.html">
            
                
                    <a href="../DOM/3、DOM事件1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.3.</b>
                        
                        DOM事件1
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.4" data-path="DOM/4、DOM事件2.html">
            
                
                    <a href="../DOM/4、DOM事件2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.4.</b>
                        
                        DOM事件2
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.5" data-path="DOM/5、移动端事件.html">
            
                
                    <a href="../DOM/5、移动端事件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.5.</b>
                        
                        移动端事件
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="9" data-path="Ajax/Ajax.html">
            
                
                    <a href="../Ajax/Ajax.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.</b>
                        
                        Ajax
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="9.1" data-path="Ajax/Ajax的实现过程.html">
            
                
                    <a href="../Ajax/Ajax的实现过程.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.1.</b>
                        
                        Ajax的实现过程
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10" data-path="jQuery/jQuery.html">
            
                
                    <a href="../jQuery/jQuery.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.</b>
                        
                        jQuery
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.1" data-path="jQuery/1、选择器和效果.html">
            
                
                    <a href="../jQuery/1、选择器和效果.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.1.</b>
                        
                        选择器和效果
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.2" data-path="jQuery/2、jQuery属性.html">
            
                
                    <a href="../jQuery/2、jQuery属性.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.2.</b>
                        
                        jQuery属性
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.3" data-path="jQuery/3、正则表达式.html">
            
                
                    <a href="../jQuery/3、正则表达式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.3.</b>
                        
                        正则表达式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.4" data-path="jQuery/4、选择器和操作.html">
            
                
                    <a href="../jQuery/4、选择器和操作.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.4.</b>
                        
                        选择器和操作
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="11" data-path="VUE/vue.html">
            
                
                    <a href="../VUE/vue.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.</b>
                        
                        VUE
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="11.1" data-path="VUE/1、绑定class和style.html">
            
                
                    <a href="../VUE/1、绑定class和style.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.1.</b>
                        
                        绑定class和style
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="11.2" data-path="VUE/2、绑定表单.html">
            
                
                    <a href="../VUE/2、绑定表单.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.2.</b>
                        
                        绑定表单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.3" data-path="VUE/3、组件之间的数据传递.html">
            
                
                    <a href="../VUE/3、组件之间的数据传递.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.3.</b>
                        
                        组件之间的数据传递
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.4" data-path="VUE/4、vue-router.html">
            
                
                    <a href="../VUE/4、vue-router.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.4.</b>
                        
                        vue-router
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.5" data-path="VUE/style样式.html">
            
                
                    <a href="../VUE/style样式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.5.</b>
                        
                        style样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.6" data-path="VUE/生命周期函数.html">
            
                
                    <a href="../VUE/生命周期函数.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.6.</b>
                        
                        生命周期函数
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.7" data-path="VUE/vue-resource.html">
            
                
                    <a href="../VUE/vue-resource.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.7.</b>
                        
                        vue-resource
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.8" data-path="VUE/axios.html">
            
                
                    <a href="../VUE/axios.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.8.</b>
                        
                        axios
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.9" data-path="VUE/vue动画.html">
            
                
                    <a href="../VUE/vue动画.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.9.</b>
                        
                        vue动画
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.10" data-path="VUE/插槽的使用.html">
            
                
                    <a href="../VUE/插槽的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.10.</b>
                        
                        插槽的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.11" data-path="VUE/ajax与框架搭建.html">
            
                
                    <a href="../VUE/ajax与框架搭建.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.11.</b>
                        
                        ajax与框架搭建
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="12" data-path="ES6/ES6.html">
            
                
                    <a href="../ES6/ES6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>12.</b>
                        
                        ES6
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="12.1" data-path="ES6/1、promise.html">
            
                
                    <a href="../ES6/1、promise.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>12.1.</b>
                        
                        promise
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="12.2" data-path="ES6/2、数组的扩展.html">
            
                
                    <a href="../ES6/2、数组的扩展.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>12.2.</b>
                        
                        数组的扩展
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="12.3" data-path="ES6/3、set的使用.html">
            
                
                    <a href="../ES6/3、set的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>12.3.</b>
                        
                        set的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="12.4" data-path="ES6/4、类和类的继承.html">
            
                
                    <a href="../ES6/4、类和类的继承.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>12.4.</b>
                        
                        类和类的继承
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="13" data-path="JS、JQ阻止事件冒泡.html">
            
                
                    <a href="../JS、JQ阻止事件冒泡.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>13.</b>
                        
                        JS、JQ阻止事件冒泡
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="14" data-path="微信小程序/微信小程序.html">
            
                
                    <a href="../微信小程序/微信小程序.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>14.</b>
                        
                        微信小程序
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >我的笔记</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x7ED1;&#x5B9A;&#x8868;&#x5355;">&#x7ED1;&#x5B9A;&#x8868;&#x5355;</h1>
<ul>
<li>v-for</li>
<li>1&#x3001;&#x5FAA;&#x73AF;&#x6570;&#x7EC4;</li>
<li>2&#x3001;&#x5FAA;&#x73AF;&#x5BF9;&#x8C61;<ul>
<li>v-for=&quot;(val,name,index) in obj&quot;;</li>
<li>val: &#x8868;&#x793A;&#x5BF9;&#x8C61;&#x7684;&#x5C5E;&#x6027;&#x503C;&#x3002;name: &#x8868;&#x793A;&#x5BF9;&#x8C61;&#x7684;&#x5C5E;&#x6027;&#x540D;&#x3002;index: &#x6BCF;&#x4E2A;&#x5BF9;&#x8C61;&#x7684;&#x5C5E;&#x6027;&#x5BF9;&#x5E94;&#x7684;&#x4E0B;&#x6807;&#x503C;</li>
</ul>
</li>
<li>3&#x3001;&#x5FAA;&#x73AF;&#x6570;&#x5B57;<ul>
<li>&#x4F8B;&#x5982;&#xFF1A;v-for=&quot;num in 10&quot;</li>
<li>&#x8868;&#x793A;&#x5FAA;&#x73AF;10&#x8FD9;&#x4E2A;&#x6570;&#x5B57;&#xFF0C;&#x5E76;&#x5C06;1&#x5230;10&#x6BCF;&#x4E00;&#x4E2A;&#x6570;&#x503C;&#x8D4B;&#x503C;&#x7ED9;num</li>
</ul>
</li>
</ul>
<pre><code>html&#x6837;&#x5F0F;&#xFF1A;
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>app<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>ul</span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span> <span class="token attr-name">v-for</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>(val,name,index) in obj<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>{ {index} }---{ {name} }---{ {val} }<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>ul</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span> <span class="token attr-name">v-for</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>num in 10<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>{ {num} }<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>ul</span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span> <span class="token attr-name">v-for</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>item in arr<span class="token punctuation">&quot;</span></span> <span class="token attr-name">@click</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>changeCont<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>{ {item} }<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>ul</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
</code></pre><pre><code>javascript&#x6837;&#x5F0F;&#xFF1A;
            new Vue({
                el:&quot;.app&quot;,
                data:{
                    obj:{
                        &quot;name&quot;:&quot;&#x5C0F;&#x660E;&quot;,
                        &quot;age&quot;:&quot;15&quot;,
                        &quot;sex&quot;:&quot;&#x7537;&quot;,
                        &quot;like&quot;:&quot;&#x5973;&quot;
                    },
                    arr:[&quot;html&quot;,&quot;css&quot;,&quot;javascript&quot;]
                },
                methods:{
                    //es6&#x8BED;&#x6CD5;&#xFF0C;&#x76F8;&#x5F53;&#x4E8E;changeCont:function(){}
                    changeCont(){
//                        this.arr[0] = &quot;java&quot;;
//                        console.log(this.arr)
                        /**
                         * &#x901A;&#x8FC7;set&#x65B9;&#x6CD5;&#x6765;&#x8BBE;&#x7F6E;&#x6570;&#x7EC4;&#x5185;&#x5BB9;&#xFF0C;&#x53EF;&#x4EE5;&#x89E6;&#x53D1;&#x89C6;&#x56FE;&#x66F4;&#x65B0;
                         * &#x6709;&#x4EE5;&#x4E0B;&#x4E24;&#x79CD;&#x5199;&#x6CD5;&#xFF1A;
                         *     this.$set(arr/obj,index/name,&#x66F4;&#x6539;&#x540E;&#x7684;&#x5185;&#x5BB9;)
                         *     arr/obj&#xFF1A;&#x8868;&#x793A;&#x9700;&#x8981;&#x66F4;&#x6539;&#x7684;&#x6570;&#x7EC4;&#x6216;&#x5BF9;&#x8C61;
                         *     index/name&#xFF1A;&#x8868;&#x793A;&#x9700;&#x8981;&#x66F4;&#x8BE5;&#x7684;&#x6570;&#x7EC4;&#x6216;&#x5BF9;&#x8C61;&#x91CC;&#x9762;&#x7684;&#x5177;&#x4F53;&#x54EA;&#x4E2A;&#x5143;&#x7D20;&#x6216;&#x5C5E;&#x6027;
                         *     
                         * */
//                        this.$set(this.arr,0,&quot;java&quot;);
                        Vue.set(this.arr,0,&quot;java&quot;)
                    }
                }
            })
</code></pre><h1 id="&#x8868;&#x5355;&#x8F93;&#x5165;&#x7ED1;&#x5B9A;">&#x8868;&#x5355;&#x8F93;&#x5165;&#x7ED1;&#x5B9A;</h1>
<h3 id="vmodel&#x662F;&#x53CC;&#x5411;&#x7ED1;&#x5B9A;&#x6307;&#x4EE4;">v-model:&#x662F;&#x53CC;&#x5411;&#x7ED1;&#x5B9A;&#x6307;&#x4EE4;</h3>
<ul>
<li>&#x4FEE;&#x9970;&#x7B26;&#xFF1A;<ul>
<li>.lazy:&#x5F53;&#x8868;&#x5355;&#x5143;&#x7D20;&#x89E6;&#x53D1;change&#x4E8B;&#x4EF6;&#x65F6;&#xFF0C;&#x624D;&#x89E6;&#x53D1;&#x6570;&#x636E;&#x66F4;&#x65B0;</li>
<li>.number:&#x5C06;&#x8868;&#x5355;&#x7684;&#x503C;&#x8F6C;&#x6362;&#x4E3A;&#x6570;&#x503C;&#x7C7B;&#x578B;</li>
<li>.trim:&#x6E05;&#x9664;&#x7528;&#x6237;&#x8F93;&#x5165;&#x7684;&#x9996;&#x5C3E;&#x7A7A;&#x683C;&#x7B26;</li>
</ul>
</li>
</ul>
<pre><code>        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>app<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>text<span class="token punctuation">&quot;</span></span> <span class="token attr-name">v-model</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>inpVal<span class="token punctuation">&quot;</span></span> <span class="token punctuation">/&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>button</span> <span class="token attr-name">@click</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>add<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>&#x589E;&#x52A0;<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>button</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>ul</span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span> <span class="token attr-name">v-for</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>item in arr<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>{ {item} }<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>ul</span><span class="token punctuation">&gt;</span></span>
            <span class="token comment" spellcheck="true">&lt;!--&lt;p&gt;{ {inpVal} }&lt;/p&gt;--&gt;</span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>textarea</span> <span class="token attr-name">v-model</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>textVal<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>textarea</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span>{ {textVal} }<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span>
            <span class="token comment" spellcheck="true">&lt;!--
                checkbox&#x590D;&#x9009;&#x6846;&#x7684;value&#x503C;&#x5FC5;&#x987B;&#x586B;&#x5199;&#xFF0C;&#x4E14;&#x503C;&#x4E0D;&#x80FD;&#x76F8;&#x540C;&#xFF0C;
                &#x5426;&#x5219;&#x4F1A;&#x9009;&#x4E2D;&#x6240;&#x6709;&#x503C;&#x76F8;&#x540C;&#x7684;&#x590D;&#x9009;&#x6846;
                &#x7ED1;&#x5B9A;&#x7684;&#x6570;&#x636E;&#x662F;&#x4E00;&#x4E2A;&#x6570;&#x7EC4;
            --&gt;</span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>checkbox<span class="token punctuation">&quot;</span></span>  <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>playBall<span class="token punctuation">&quot;</span></span>  <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>&#x6253;&#x7403;<span class="token punctuation">&quot;</span></span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>hobby<span class="token punctuation">&quot;</span></span>  <span class="token attr-name">v-model</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>checkeds<span class="token punctuation">&quot;</span></span> <span class="token punctuation">/&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>label</span> <span class="token attr-name">for</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>playBall<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>&#x6253;&#x7403;<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>label</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>checkbox<span class="token punctuation">&quot;</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>swimming<span class="token punctuation">&quot;</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>&#x6E38;&#x6CF3;<span class="token punctuation">&quot;</span></span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>hobby<span class="token punctuation">&quot;</span></span> <span class="token attr-name">v-model</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>checkeds<span class="token punctuation">&quot;</span></span> <span class="token punctuation">/&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>label</span> <span class="token attr-name">for</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>swimming<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>&#x6E38;&#x6CF3;<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>label</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>checkbox<span class="token punctuation">&quot;</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>coding<span class="token punctuation">&quot;</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>&#x6572;&#x4EE3;&#x7801;<span class="token punctuation">&quot;</span></span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>hobby<span class="token punctuation">&quot;</span></span> <span class="token attr-name">v-model</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>checkeds<span class="token punctuation">&quot;</span></span> <span class="token punctuation">/&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>label</span> <span class="token attr-name">for</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>coding<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>&#x6572;&#x4EE3;&#x7801;<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>label</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span>{ {checkeds} }<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span>
            <span class="token comment" spellcheck="true">&lt;!--
                &#x5355;&#x9009;&#x6309;&#x94AE;
                    &#x7ED1;&#x5B9A;&#x7684;&#x6570;&#x636E;&#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#x4E5F;&#x53EF;&#x4EE5;&#x662F;&#x6570;&#x7EC4;(&#x901A;&#x5E38;&#x76F4;&#x63A5;&#x7528;&#x5B57;&#x7B26;&#x4E32;)&#x3002;
            --&gt;</span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>radio<span class="token punctuation">&quot;</span></span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>sex<span class="token punctuation">&quot;</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>&#x7537;<span class="token punctuation">&quot;</span></span> <span class="token attr-name">v-model</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>selRadio<span class="token punctuation">&quot;</span></span><span class="token punctuation">/&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>radio<span class="token punctuation">&quot;</span></span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>sex<span class="token punctuation">&quot;</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>&#x5973;<span class="token punctuation">&quot;</span></span> <span class="token attr-name">v-model</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>selRadio<span class="token punctuation">&quot;</span></span> <span class="token punctuation">/&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span>{ {selRadio} }<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span>

            <span class="token comment" spellcheck="true">&lt;!--
                &#x9009;&#x62E9;&#x4E0B;&#x62C9;&#x6846;
                    &#x7ED1;&#x5B9A;&#x7684;&#x6570;&#x636E;&#x662F;&#x5B57;&#x7B26;&#x4E32;
                    &#x5982;&#x679C;&#x8BBE;&#x7F6E;&#x4E86;&#x5C5E;&#x6027;&#x4E3A;multiple&#xFF0C;&#x5219;&#x9700;&#x8981;&#x628A;&#x7ED1;&#x5B9A;&#x7684;&#x6570;&#x636E;&#x53D8;&#x4E3A;&#x6570;&#x7EC4;&#x3002;

                    multiple&#xFF1A;&#x591A;&#x9009;
                    disabled&#xFF1A;&#x7981;&#x6B62;&#x9009;&#x62E9;
            --&gt;</span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>select</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>city<span class="token punctuation">&quot;</span></span> <span class="token attr-name">v-model</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>selOption<span class="token punctuation">&quot;</span></span> <span class="token attr-name">multiple</span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>option</span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span><span class="token punctuation">&quot;</span></span> <span class="token attr-name">disabled</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>disabled<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>&#x8BF7;&#x9009;&#x62E9;<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>option</span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>option</span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>&#x5E7F;&#x5DDE;<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>&#x5E7F;&#x5DDE;<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>option</span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>option</span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>&#x6DF1;&#x5733;<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>&#x6DF1;&#x5733;<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>option</span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>option</span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>&#x63ED;&#x9633;<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>&#x63ED;&#x9633;<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>option</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>select</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>select</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>provinces<span class="token punctuation">&quot;</span></span> <span class="token attr-name">v-model</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>selected<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>option</span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span><span class="token punctuation">&quot;</span></span> <span class="token attr-name">disabled</span><span class="token punctuation">&gt;</span></span>&#x8BF7;&#x9009;&#x62E9;<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>option</span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>option</span> <span class="token attr-name">v-for</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>item in list<span class="token punctuation">&quot;</span></span> <span class="token attr-name">:value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>item<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>{ {item} }<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>option</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>select</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span>{ {selected} }<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span>

            <span class="token comment" spellcheck="true">&lt;!--&#x590D;&#x9009;&#x6846;--&gt;</span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>checkbox<span class="token punctuation">&quot;</span></span> <span class="token attr-name">v-model</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>toggle<span class="token punctuation">&quot;</span></span> <span class="token attr-name">true-value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>true<span class="token punctuation">&quot;</span></span> <span class="token attr-name">false-value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>false<span class="token punctuation">&quot;</span></span> <span class="token attr-name">@change</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>inpChange<span class="token punctuation">&quot;</span></span> <span class="token punctuation">/&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span>{ {toggle} }<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span>

            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>radio<span class="token punctuation">&quot;</span></span> <span class="token attr-name">v-model</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>pick<span class="token punctuation">&quot;</span></span> <span class="token attr-name">:value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>a<span class="token punctuation">&quot;</span></span> <span class="token punctuation">/&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span>{ {pick} }<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span>

            <span class="token comment" spellcheck="true">&lt;!--&#x4E0B;&#x62C9;&#x6846;--&gt;</span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>select</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span><span class="token punctuation">&quot;</span></span> <span class="token attr-name">v-model</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>sel<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>option</span> <span class="token attr-name">:value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>{name:123}<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>123<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>option</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>select</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span>{ {sel.name} }<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span>

            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>text<span class="token punctuation">&quot;</span></span> <span class="token attr-name">v-model.lazy</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>test<span class="token punctuation">&quot;</span></span> <span class="token punctuation">/&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span>{ {test} }<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>number<span class="token punctuation">&quot;</span></span> <span class="token attr-name">v-model.number</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>num<span class="token punctuation">&quot;</span></span> <span class="token attr-name">@input</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>changeNum<span class="token punctuation">&quot;</span></span><span class="token punctuation">/&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span>{ {num,typeof(num)} }<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
</code></pre><pre><code>            var vm = new Vue({
                el:&quot;.app&quot;,
                data:{
                    inpVal:&quot;123&quot;,
                    arr:[],
                    textVal:&quot;1234&quot;,
                    checkeds:[&quot;&#x6E38;&#x6CF3;&quot;],
                    selRadio:&quot;&#x7537;&quot;,//&#x8BBE;&#x7F6E;&#x9ED8;&#x8BA4;&#x503C;
                    selOption:[],
                    list:[&quot;&#x5E7F;&#x4E1C;&#x7701;&quot;,&quot;&#x5E7F;&#x897F;&#x7701;&quot;,&quot;&#x6E56;&#x5357;&#x7701;&quot;],
                    selected:&quot;&quot;,
                    toggle:&quot;&quot;,
                    pick:&quot;&quot;,
                    a:&quot;&#x7537;&quot;,
                    sel:&quot;&quot;,
                    test:&quot;&quot;,
                    num:&quot;&quot;
                },
                methods:{
                    add:function(){
                        console.log(this.inpVal);
                        this.arr.push(this.inpVal);
                        //&#x53EF;&#x4EE5;&#x901A;&#x8FC7;this.$data&#x83B7;&#x53D6;&#x5230;data&#x91CC;&#x9762;&#x7684;&#x6240;&#x6709;&#x6570;&#x636E;
                        console.log(this.$data);
                    },
                    inpChange:function(e){
                        console.log(this.toggle,e.target.checked);
                    },
                    changeNum:function(){
                        console.log(this.num,typeof(this.num));
                    }
                }
            })
</code></pre><h1 id="&#x81EA;&#x5B9A;&#x4E49;&#x6307;&#x4EE4;">&#x81EA;&#x5B9A;&#x4E49;&#x6307;&#x4EE4;</h1>
<ul>
<li>&#x53EF;&#x4EE5;&#x901A;&#x8FC7;Vue.directive(&quot;name&quot;,callback(el,binding))&#x6765;&#x81EA;&#x5B9A;&#x4E49;&#x6307;&#x4EE4;<ul>
<li>name:&#x6307;&#x4EE4;&#x540D;&#xFF0C;&#x7528;&#x7684;&#x65F6;&#x5019;&#x662F;&#x901A;&#x8FC7; v-name&#x6765;&#x6DFB;&#x52A0;&#x6307;&#x4EE4;</li>
<li>callback:&#x6307;&#x4EE4;&#x7684;&#x56DE;&#x8C03;&#x51FD;&#x6570;<ul>
<li>el:&#x4EE3;&#x8868;&#x6211;&#x4EEC;&#x8981;&#x6DFB;&#x52A0;&#x8BE5;&#x6307;&#x4EE4;&#x7684;&#x5143;&#x7D20;</li>
<li>binding:&#x4EE3;&#x8868;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#xFF0C;&#x7528;&#x4E8E;&#x63A5;&#x6536;&#x7528;&#x6237;&#x8C03;&#x7528;&#x6307;&#x4EE4;&#x65F6;&#x4F20;&#x5165;&#x7684;&#x53C2;&#x6570;</li>
</ul>
</li>
</ul>
</li>
</ul>
<pre><code>        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>app<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span> <span class="token attr-name">v-fontcolor</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span><span class="token punctuation">&apos;</span>gray<span class="token punctuation">&apos;</span><span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>&#x4ECA;&#x5929;&#x5929;&#x6C14;&#x771F;&#x597D;&#xFF01;<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
</code></pre><pre><code>            Vue.directive(&quot;fontcolor&quot;,function(el,binding){
                if(binding.value){
                    color = binding.value;
                }else{
                    color = &quot;skyblue&quot;
                }
                el.style.color = color;
            })
            var vm = new Vue({
                el:&quot;.app&quot;
            })
</code></pre><h1 id="&#x751F;&#x547D;&#x5468;&#x671F;">&#x751F;&#x547D;&#x5468;&#x671F;</h1>
<ul>
<li>&#x7BAD;&#x5934;&#x51FD;&#x6570;&#x4F1A;&#x7ED1;&#x5B9A;this&#x7684;&#x6307;&#x5411;&#xFF0C;&#x662F;&#x7ED1;&#x5B9A;&#x89E6;&#x53D1;&#x8BE5;&#x51FD;&#x6570;&#x7684;&#x5BF9;&#x8C61;&#x3002;&#x6240;&#x4EE5;&#x5728;vue&#x4E2D;&#x5C11;&#x7528;&#x7BAD;&#x5934;&#x51FD;&#x6570;</li>
</ul>
<pre><code>            var vm = new Vue({
                el:&quot;.app&quot;,
                data:{
                    name:&quot;&#x5C0F;&#x660E;&quot;
                },
                beforeCreate:function(){
                    //&#x5BF9;&#x8C61;&#x5B9E;&#x4F8B;&#x5316;&#x51FA;&#x6765;&#x540E;&#x4F1A;&#x9A6C;&#x4E0A;&#x89E6;&#x53D1;beforeCreate&#x94A9;&#x5B50;&#x51FD;&#x6570;
                    //&#x6B64;&#x65F6;&#x6CA1;&#x6709;&#x4EFB;&#x4F55;&#x6570;&#x636E;
                    console.log(this.$el,this.$data,this)
                },
                created:function(){
                    //&#x53EF;&#x4EE5;&#x83B7;&#x53D6;&#x5230;&#x6570;&#x636E;&#xFF0C;el&#x6A21;&#x677F;&#x8FD8;&#x6CA1;&#x6E32;&#x67D3;&#x5230;&#x9875;&#x9762;
                    //&#x901A;&#x5E38;&#x6211;&#x4EEC;&#x4F1A;&#x5728;&#x8FD9;&#x4E2A;&#x94A9;&#x5B50;&#x51FD;&#x6570;&#x4E2D;&#x8FDB;&#x884C;ajax&#x8BF7;&#x6C42;
                    console.log(this.$el,this.$data)
                },
                beforeMount:function(){
                    //&#x6B64;&#x65F6;el&#x6A21;&#x677F;&#x5DF2;&#x7ECF;&#x6E32;&#x67D3;&#x5230;&#x9875;&#x9762;&#x4E86;
                    console.log(this.$el)
                },
                mounted:function(){
                    //&#x901A;&#x8FC7;&#x53EF;&#x4EE5;&#x505A;&#x4E00;&#x4E9B;&#x4E8B;&#x4EF6;&#x76D1;&#x542C;
                    document.addEventListener(&quot;keydown&quot;,function(e){
                        console.log(e);
                    })
                },
                beforeUpdate:function(){
                    //&#x6570;&#x636E;&#x66F4;&#x65B0;&#x524D;&#x4F1A;&#x89E6;&#x53D1;
                },
                update:function(){
                    //&#x6570;&#x636E;&#x66F4;&#x65B0;&#x540E;&#x89E6;&#x53D1;
                },
                beforeDestroy:function(){
                    //vue&#x5B9E;&#x4F8B;&#x9500;&#x6BC1;&#x524D;&#x89E6;&#x53D1;
                },
                destroyed:function(){
                    //vue&#x5B9E;&#x4F8B;&#x9500;&#x6BC1;&#x540E;&#x89E6;&#x53D1;
                }
            })
</code></pre><h1 id="&#x7EC4;&#x4EF6;">&#x7EC4;&#x4EF6;</h1>
<ul>
<li><p>&#x5168;&#x5C40;&#x7EC4;&#x4EF6;</p>
<pre><code>Vue.component(&quot;test&quot;,{
  //props&#x9009;&#x9879;&#x5C06;&#x5176;&#x5305;&#x542B;&#x5728;&#x8BE5;&#x7EC4;&#x4EF6;&#x53EF;&#x63A5;&#x53D7;&#x7684; prop &#x5217;&#x8868;&#x4E2D;
  //Prop &#x662F;&#x4F60;&#x53EF;&#x4EE5;&#x5728;&#x7EC4;&#x4EF6;&#x4E0A;&#x6CE8;&#x518C;&#x7684;&#x4E00;&#x4E9B;&#x81EA;&#x5B9A;&#x4E49;&#x7279;&#x6027;&#x3002;&#x5F53;&#x4E00;&#x4E2A;&#x503C;&#x4F20;&#x9012;&#x7ED9;&#x4E00;&#x4E2A; prop &#x7279;&#x6027;&#x7684;&#x65F6;&#x5019;&#xFF0C;
  //&#x5B83;&#x5C31;&#x53D8;&#x6210;&#x4E86;&#x90A3;&#x4E2A;&#x7EC4;&#x4EF6;&#x5B9E;&#x4F8B;&#x7684;&#x4E00;&#x4E2A;&#x5C5E;&#x6027;
  props:[&quot;content&quot;],
  template:&quot;<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>&quot;
})
</code></pre></li>
<li><p>&#x5C40;&#x90E8;&#x7EC4;&#x4EF6;,&#x9700;&#x8981;&#x5728;vue&#x5B9E;&#x4F8B;&#x4E2D;&#x8FDB;&#x884C;&#x6CE8;&#x518C;</p>
</li>
<li>&#x7EC4;&#x4EF6;&#x5177;&#x6709;&#x548C;vue&#x5B9E;&#x4F8B;&#x5BF9;&#x8C61;&#x4E00;&#x6837;&#x7684;&#x529F;&#x80FD;</li>
<li>&#x4E0D;&#x540C;&#x70B9;&#x5728;&#x4E8E;data&#x7C7B;&#x578B;&#x4E0D;&#x4E00;&#x6837;&#xFF0C;&#x7EC4;&#x4EF6;&#x91CC;&#x9762;&#x7684;data&#x5FC5;&#x987B;&#x662F;&#x4E00;&#x4E2A;&#x51FD;&#x6570;</li>
</ul>
<pre><code>            var test2 = {
                template:&quot;<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span>789<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span>&quot;,
                data:function(){
                    return{

                    }
                }
            }
            var vm = new Vue({
                el:&apos;.app&apos;,
                data:{
                    inpVal:&quot;&quot;,
                    list:[]
                },
                methods:{
                    add:function(){
                        //&#x83B7;&#x53D6;&#x7528;&#x6237;&#x8F93;&#x5165;&#x7684;&#x5185;&#x5BB9;
                        console.log(this.inpVal);
                        this.list.push(this.inpVal);
                    }
                },





                components:{//&#x6CE8;&#x518C;&#x5C40;&#x90E8;&#x7EC4;&#x4EF6;
                    test2:test2
                }
            })
</code></pre><pre><code>        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>app<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token comment" spellcheck="true">&lt;!--&lt;test&gt;&lt;/test&gt;
            &lt;test2&gt;&lt;/test2&gt;--&gt;</span>

            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>text<span class="token punctuation">&quot;</span></span> <span class="token attr-name">v-model</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>inpVal<span class="token punctuation">&quot;</span></span> <span class="token punctuation">/&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>button</span> <span class="token attr-name">@click</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>add<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>&#x6DFB;&#x52A0;<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>button</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>ul</span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>test</span> <span class="token attr-name">v-for</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>item in list<span class="token punctuation">&quot;</span></span> <span class="token attr-name">:content</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>item<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>test</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>ul</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
</code></pre><h1 id="&#x7236;&#x7EC4;&#x4EF6;&#x4F20;&#x9012;&#x6570;&#x636E;&#x7ED9;&#x5B50;&#x7EC4;&#x4EF6;">&#x7236;&#x7EC4;&#x4EF6;&#x4F20;&#x9012;&#x6570;&#x636E;&#x7ED9;&#x5B50;&#x7EC4;&#x4EF6;</h1>
<ul>
<li>&#x7236;&#x7EC4;&#x4EF6;&#x5411;&#x5B50;&#x7EC4;&#x4EF6;&#x4F20;&#x9012;&#x6570;&#x636E;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;props<ul>
<li>&#x65B9;&#x6CD5;&#x4E00;&#xFF1A;</li>
<li>&#x53EF;&#x4EE5;&#x901A;&#x8FC7;props<ul>
<li>props&#x6570;&#x7EC4;&#x91CC;&#x9762;&#x7684;&#x5143;&#x7D20;(&#x5143;&#x7D20;&#x540D;&#x79F0;&#x662F;&#x81EA;&#x5B9A;&#x4E49;&#x7684;)&#x5219;&#x662F;&#x627F;&#x8F7D;&#x4ECE;&#x7236;&#x7EC4;&#x4EF6;&#x4E2D;&#x4F20;&#x9012;&#x8FC7;&#x6765;&#x7684;&#x6570;&#x636E;&#x7684;&#x53D8;&#x91CF;</li>
</ul>
</li>
<li>&#x600E;&#x4E48;&#x5C06;&#x6570;&#x636E;&#x4F20;&#x9012;&#x8FC7;&#x6765;&#xFF1F;<ul>
<li>&#x901A;&#x8FC7;v-bind:&#x7ED1;&#x5B9A;props&#x6570;&#x7EC4;&#x4E2D;&#x7684;&#x5143;&#x7D20;&#xFF0C;&#x5E76;&#x5C06;&#x7236;&#x7EC4;&#x4EF6;&#x4E2D;&#x7684;&#x6570;&#x636E;&#x8D4B;&#x503C;&#x7ED9;&#x8BE5;&#x5143;&#x7D20;</li>
</ul>
</li>
<li>&#x65B9;&#x6CD5;&#x4E8C;&#xFF1A;</li>
<li>&#x901A;&#x8FC7;$root&#x6765;&#x83B7;&#x53D6;&#xFF0C;&#x4F8B;&#x5B50;&#x5982;&#x4E0B;</li>
</ul>
</li>
</ul>
<pre><code>            Vue.component(&quot;test&quot;,{
                props:[&quot;content&quot;],
                template:`<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span><span class="token punctuation">&gt;</span></span>&#x6211;&#x5728;&#x5B50;&#x7EC4;&#x4EF6;&#x91CC;&#x9762;&#xFF1A;{ {content} }
                            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>h1</span><span class="token punctuation">&gt;</span></span>{ {$root.data1} }---{ {$root.data2} }<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>h1</span><span class="token punctuation">&gt;</span></span>
                        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>`
            })
            var vm = new Vue({
                el:&quot;.app&quot;,
                data:{
                    data1:&quot;&#x6211;&#x662F;&#x7236;&#x7EC4;&#x4EF6;&#x91CC;&#x9762;&#x7684;&#x6570;&#x636E;&quot;,
                    data2:&quot;123&quot;
                },
            })
</code></pre><h1 id="&#x5B50;&#x7EC4;&#x4EF6;&#x4F20;&#x9012;&#x6570;&#x636E;&#x7ED9;&#x7236;&#x7EC4;&#x4EF6;">&#x5B50;&#x7EC4;&#x4EF6;&#x4F20;&#x9012;&#x6570;&#x636E;&#x7ED9;&#x7236;&#x7EC4;&#x4EF6;</h1>
<ul>
<li>&#x5B50;&#x7EC4;&#x4EF6;&#x5411;&#x7236;&#x7EC4;&#x4EF6;&#x4F20;&#x9012;&#x6570;&#x636E;</li>
<li><p>&#x65B9;&#x6CD5;&#x4E00;&#xFF1A;</p>
<ul>
<li>&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x4E8B;&#x4EF6;&#x5C06;&#x6570;&#x636E;&#x4F20;&#x9012;&#x7ED9;&#x7236;&#x7EC4;&#x4EF6;&#xFF0C;&#x8FD8;&#x53EF;&#x4EE5;&#x7528;&#x5230;vue&#x63D0;&#x4F9B;&#x7684;&#x4E00;&#x4E2A;&#x65B9;&#x6CD5;$emit()&#x3002;</li>
</ul>
</li>
<li><p>&#x65B9;&#x6CD5;&#x4E8C;&#xFF1A;</p>
<ul>
<li>&#x901A;&#x8FC7;vm.$refs&#x6765;&#x83B7;&#x53D6;</li>
<li>&#x6CE8;&#x610F;&#xFF1A;&#x7528;&#x5230;&#x8FD9;&#x79CD;&#x65B9;&#x6CD5;&#x8FD8;&#x9700;&#x8981;&#x901A;&#x8FC7;ref&#x6765;&#x8BBE;&#x7F6E;&#x5B50;&#x7EC4;&#x4EF6;&#x7684;&#x540D;&#x5B57;</li>
</ul>
</li>
</ul>
<pre><code>        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>app<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span> <span class="token attr-name">@click</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>changeCont<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>{ {sonData} }<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span>
            <span class="token comment" spellcheck="true">&lt;!--child&#x662F;&#x5B50;&#x7EC4;&#x4EF6;&#x7684;&#x540D;&#x5B57;&#xFF0C;&#x662F;&#x81EA;&#x5B9A;&#x4E49;&#x7684;--&gt;</span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>test</span> <span class="token attr-name">ref</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>child<span class="token punctuation">&quot;</span></span> <span class="token attr-name">@receiveson</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>receiveData<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>test</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
</code></pre><pre><code>            Vue.component(&quot;test&quot;,{
                template:&quot;<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>h1</span> <span class="token attr-name">@click</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&apos;</span>toParent<span class="token punctuation">&apos;</span></span><span class="token punctuation">&gt;</span></span>{ {data1} }<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>h1</span><span class="token punctuation">&gt;</span></span>&quot;,
                data:function(){
                    return{
                        data1:&quot;&#x6211;&#x662F;&#x5B50;&#x7EC4;&#x4EF6;&#x91CC;&#x9762;&#x7684;&#x6570;&#x636E;&quot;
                    }
                },
                methods:{
                    toParent:function(){
                        //&#x901A;&#x8FC7;$emit&#x65B9;&#x6CD5;&#x5C06;&#x6570;&#x636E;&#x4F20;&#x9012;&#x7ED9;&#x7236;&#x7EC4;&#x4EF6;
                        //$emit(event,data)
                        //event:&#x81EA;&#x5B9A;&#x4E49;&#x4E8B;&#x4EF6;&#x7C7B;&#x578B;
                        //data:&#x6211;&#x4EEC;&#x9700;&#x8981;&#x4F20;&#x9012;&#x7684;&#x6570;&#x636E;
                        this.$emit(&quot;receiveson&quot;,this.data1)
                    }
                }
            })
            var vm = new Vue({
                el:&quot;.app&quot;,
                data:{
                    sonData:&quot;12345&quot;
                },
                methods:{
                    receiveData:function(data1){
                        console.log(data1)
                    },
                    changeCont:function(){
                        console.log(this.$refs);
                        this.sonData = this.$refs.child.data1;
                    }
                }
            })
</code></pre>
                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../VUE/1、绑定class和style.html" class="navigation navigation-prev " aria-label="Previous page: 绑定class和style"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../VUE/3、组件之间的数据传递.html" class="navigation navigation-next " aria-label="Next page: 组件之间的数据传递"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"prism":{"css":["prismjs/themes/prism-solarizedlight.css"]},"emphasize":{},"expandable-chapters":{},"fontsettings":{"theme":"white","family":"sans","size":2},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"livereload":{}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
